package com.cxb;

import android.os.Bundle;
import android.widget.Toast;

import com.cxb.utils.SharedPreferencesUtils;
import com.cxb.utils.Tts;
import com.cxb.view.WiperSwitch;
import com.cxb.view.WiperSwitch.OnChangedListener;

public class EdogActivity extends BaseActivity {

	private WiperSwitch wiperSwitch;
	private SharedPreferencesUtils spPreferencesUtils;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_edog);

		spPreferencesUtils = new SharedPreferencesUtils(this);
		wiperSwitch = (WiperSwitch) findViewById(R.id.wiperSwitch);

		wiperSwitch.setChecked(spPreferencesUtils.getSetUpEdogWhenBootUp());
		wiperSwitch.setOnChangedListener(new OnChangedListener() {

			@Override
			public void OnChanged(WiperSwitch wiperSwitch, boolean checkState) {
				if (checkState != spPreferencesUtils.getSetUpEdogWhenBootUp()) {
					spPreferencesUtils.setSetUpEdogWhenBootUpt(checkState);
					Toast.makeText(EdogActivity.this, R.string.setting_ok, 0)
							.show();
					Tts.speak(getString(R.string.setting_ok));
				}

			}
		});

	}
}
